package team.archai.nexus.boot.web.providers;

import cn.hutool.extra.servlet.ServletUtil;
import org.springframework.security.authentication.AuthenticationDetailsSource;
import team.archai.nexus.boot.auth.model.AuthRequest;

import javax.servlet.http.HttpServletRequest;

/**
 * @description: auth detail
 * @author: lishibin
 * @create: 2020-07-11 20:26
 **/
public class AuthDetail implements AuthenticationDetailsSource<HttpServletRequest, AuthRequest> {

    @Override
    public AuthRequest buildDetails(HttpServletRequest request) {
        AuthRequest authRequest = AuthRequest.builder().build();
        ServletUtil.fillBean(request, authRequest, true);
        return authRequest;
    }
}
